#-------------------------------------------------------------------------------
# Name:        User_Service
# Purpose:
#
# Author:      irolary
#
# Created:     22-08-2010
# Copyright:   (c) irolary 2010
# Licence:     <your licence>
#-------------------------------------------------------------------------------
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from google.appengine.ext import db
from db_model import DBservice,KonoDB
from req_handler import KonoCmd
class IknowNothing(object):
    pass

class KonoService():
    def __init__(self):
        self._results = None
    def addUser(self,add):
        db_ser=DBservice(add)
        if (not db_ser.isUser()):
            db_ser.createUser()
        self._results=db_ser.getQuery()
class Cmd_setup(KonoCmd):
    def __init__(self,message,args,add,lang=None):
        KonoCmd.__init__(self,message,args,lang=None)
        self.add=add
    def _parseCmd(self):
        db_ser = DBService(self.add)
        if self.leftargs[0]=='lang':
            db_ser.setLang(self.leftargs[0])
        elif self.leftargs[0]=='list':
            db_ser.setStlist(self.leftargs[1:])
        elif self.leftargs[0]=='del':
            db_ser.delUser()
    def do_reply(self):
        self._parseCmd(self.add)
        su=str(db_ser.email)
        return su

def main():
    pass
if __name__ == '__main__':
    main()